package com.mapper.jpa;

import com.core.base.BaseMapper;
import com.model.jpa.Users;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface UsersRepository extends BaseMapper<Users,Long> {

    Page<Users> findAll(Pageable pageable);

    Page<Users> findAllByRealName(Pageable pageable,String realName);

    void deleteById(Long id);

    @Query("select new Users(u.userName,u.realName,u.password,u.gender) from Users u where u.userName = ?1")
    Users findByUserName(String userName);

    Users findByUserNameAndPassword(String userName,String password);

}
